<?php
/* CORE LOAD JAVASCRIPTS
 *
 * Carga todos los css permanentes del sitio web, la lista la obtiene
 * del config.ini
 *
 */

foreach($this->config->layout->css as  $key => $name){
    echo cargarCSS($this->config, $name, $this->baseUrl);
}

function cargarCSS($config, $filename, $baseUrl){

    $path =
        realpath('.')   . DIRECTORY_SEPARATOR
        .'styles'       . DIRECTORY_SEPARATOR;

    if(file_exists($path . $filename)){

        return '<link rel="stylesheet" type="text/css" media="screen" href="'.$baseUrl.'/styles/'.$filename.'" />'."\n";

    }else{

        if(substr_count($filename, 'http')){
            return '<link rel="stylesheet" type="text/css" media="screen" href="'.$filename.'" />'."\n";
        }else{
            return '<!-- No existe ' . $filename . '-->'."\n";
        }

    }
}